import {
  exportUrl,
  getBarcodePrintTempList
} from '@/api/print/mesProdOthercodePrintHistory'
import { getDict } from '@/api/common'

// 列表头按钮配置
export const operateList = [
  {
    name: $i18n.t('common.export'),
    type: 'primary',
    icon: 'el-icon-download',
    handleName: 'export', // 点击时返回的标识
    url: exportUrl
  },
  {
    name: $i18n.t('mesOtherCodePrintingRecord.reprint'),
    type: 'primary',
    icon: 'el-icon-printer',
    handleName: 'repairPrint', // 点击时返回的标识
    isSingle: true,
    // auth: 'mes:otherCode:reprint', // 权限字段
  }
]
// 行末按钮配置
export const rowConfig = []
// 搜索条件配置
export const searchConfig = {
  inline: true,
  formDesc: {
    planCode: {
      type: 'input',
      label: $i18n.t('mesOtherCodePrintingRecord.planCode')
    },
    orderCode: {
      type: 'input',
      label: $i18n.t('mesOtherCodePrintingRecord.orderCode')
    },
    prodCode: {
      type: 'input',
      label: $i18n.t('mesOtherCodePrintingRecord.prodCode')
    },

    prodName: {
      type: 'input',
      label: $i18n.t('mesOtherCodePrintingRecord.prodName')
    },
    barcode: {
      type: 'input',
      label: $i18n.t('mesOtherCodePrintingRecord.barcode')
    },

    printtype: {
      type: 'select',
      label: $i18n.t('mesOtherCodePrintingRecord.printType'),
      prop: {
        value: 'value',
        text: 'description'
      },
      options: async (data) => {
        const list = await getDict('printType')
        return list.data.result
      }
    },
    barcodePrintTemp: {
      type: 'select',
      label: $i18n.t('mesOtherCodePrintingRecord.barcodePrintTemp'),
      prop: {
        value: 'templateName',
        text: 'templateName'
      },
      options: async (data) => {
        const list = await getBarcodePrintTempList({ activeFlag: 'Y' })
        return list.data.result
      }
    },
    seriesCode: {
      type: 'input',
      label: $i18n.t('mesOtherCodePrintingRecord.seriesCode')
    },
    seriesName: {
      type: 'input',
      label: $i18n.t('mesOtherCodePrintingRecord.seriesName')
    },
    printtime: {
      type: 'datetimerange',

      label: $i18n.t('mesOtherCodePrintingRecord.printTime'),
      attrs: {
        valueFormat: 'yyyy-MM-dd HH:mm:ss',
        searchArrKey: ['printtimeMin', 'printtimeMax']
      }
    }
  }
}
// 新增/删除表单配置
export const formDescDialog = {
  span: 24,
  disabled: false,
  isShowSubmitBtn: true,
  formDesc: {
    planCode: {
      type: 'input',
      label: $i18n.t('mesOtherCodePrintingRecord.planCode'),
      layout: 12,
      required: false
    },
    orderCode: {
      type: 'input',
      label: $i18n.t('mesOtherCodePrintingRecord.orderCode'),
      layout: 12,
      required: false
    },
    prodCode: {
      type: 'input',
      label: $i18n.t('mesOtherCodePrintingRecord.prodCode'),
      layout: 12,
      required: false
    },
    prodName: {
      type: 'input',
      label: $i18n.t('mesOtherCodePrintingRecord.prodName'),
      layout: 12,
      required: false
    },
    seriesCode: {
      type: 'input',
      label: $i18n.t('mesOtherCodePrintingRecord.seriesCode'),
      layout: 12,
      required: false
    },
    seriesName: {
      type: 'input',
      label: $i18n.t('mesOtherCodePrintingRecord.seriesName'),
      layout: 12,
      required: false
    },
    barcode: {
      type: 'input',
      label: $i18n.t('mesOtherCodePrintingRecord.barcode'),
      layout: 12,
      required: false
    },
    barcodePrintTemp: {
      type: 'input',
      label: $i18n.t('mesOtherCodePrintingRecord.barcodePrintTemp'),
      layout: 12,
      required: false
    },
    printtime: {
      type: 'datetime',
      label: $i18n.t('mesOtherCodePrintingRecord.printTime'),
      layout: 12,
      required: false,
      attrs: {
        valueFormat: 'yyyy-MM-dd HH:mm:ss'
      }
    },
    printtype: {
      type: 'select',
      label: $i18n.t('mesOtherCodePrintingRecord.printType'),
      layout: 12,
      required: false,
      prop: {
        value: 'value',
        text: 'description'
      },
      options: async (data) => {
        const list = await getDict('printType')
        return list.data.result
      }
    },
    userCode: {
      type: 'input',
      label: $i18n.t('mesOtherCodePrintingRecord.printByCode'),
      layout: 12,
      required: false
    },
    userName: {
      type: 'input',
      label: $i18n.t('mesOtherCodePrintingRecord.printByName'),
      layout: 12,
      required: false
    },
    remark: {
      type: 'textarea',
      label: $i18n.t('common.remark'),
      layout: 12,
      required: false
    }
  }
}
